/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  						 play_combat_animation.h

	$Header: /heroes4/play_combat_animation.h $

	$NoKeywords: $

 ************************************************************************/

#if !defined( PLAY_COMBAT_ANIMATION_H_INCLUDED )
#define PLAY_COMBAT_ANIMATION_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "combat_creature_handler.h"
#include "combat_creature_ptr.h"
#include "counted_animation.h"
#include "counted_idle_processor.h"
#include "handler.h"
#include "sized_int_types.h"

class t_battlefield;
enum  t_combat_actor_action_id;
class t_combat_creature;
enum  t_direction;

// ------------------------------------------------------
// class to play a combat animation
// ------------------------------------------------------
class t_play_combat_animation : public t_counted_idle_processor, public t_counted_animation
{
public:
	t_play_combat_animation( t_combat_creature& creature, 
							 t_direction direction, t_combat_actor_action_id action,
							 bool play_sound = true );
	virtual ~t_play_combat_animation();

	t_combat_actor_action_id  get_action() const;
	t_combat_creature_handler get_end_handler() const;
	virtual void			  on_idle();
	void					  set_key_frame_handler( t_combat_creature_handler handler );
	void				      set_end_handler( t_combat_creature_handler handler );
	void                      set_reverse( bool arg = true );
protected:
	t_combat_actor_action_id  m_action;
	t_combat_creature_ptr	  m_creature;
	t_combat_creature_handler m_end_handler;
	t_combat_creature_handler m_key_frame_handler;
	bool					  m_key_frame_hit;
	bool                      m_reverse_order;
	bool                      m_started;
};

inline t_combat_actor_action_id t_play_combat_animation::get_action() const
{
	return m_action;
}

inline t_combat_creature_handler t_play_combat_animation::get_end_handler() const
{
	return m_end_handler;
}


inline void	t_play_combat_animation::set_end_handler( t_combat_creature_handler handler )
{
	m_end_handler = handler;
}

inline void t_play_combat_animation::set_key_frame_handler( t_combat_creature_handler handler )
{
	m_key_frame_handler = handler;
}

typedef t_counted_ptr< t_play_combat_animation > t_play_combat_animation_ptr;

#endif // PLAY_COMBAT_ANIMATION_H_INCLUDED